<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template_dialog.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<link href="/resources/plugins/datatables/dataTables.bootstrap.css" rel="stylesheet" />
		<link href='/resources/bootstrap/css/bootstrap-datetimepicker.min.css' rel='stylesheet' />
		<style>
#accountInfo .box-header {
	padding: 19px;
}

#statistics .box-title {
	font-size: 16px;
}

#vol p:nth-child(2) {
	font-size: 15px;
}

select {
	color: black;
}

.ui-autocomplete-input {
	width: 100%;
}

.box-body {
	border-top-left-radius: 0;
	border-top-right-radius: 0;
	border-bottom-right-radius: 3px;
	border-bottom-left-radius: 3px;
	padding: 10px;
	height: 720px;
}
</style>
		<title>数据源告警</title>
	</ui:define>
	<ui:define name="content">
		<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
			<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
			<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
		</p:confirmDialog>
		<div class='full-center-content-scroll-noheader'>
			<div class="nav-tabs-custom" style="position: relative">
				<ul id="lineFaultUl" class="nav nav-tabs pull-left">
					<li class="active"><a href="#totalPan" data-toggle="tab">告警分析</a></li>
					<li><a href="#detailPan" data-toggle="tab">告警详情</a></li>
				</ul>
				<div class="tab-content no-padding">
					<div id="totalPan" class="chart tab-pane active" style="position: relative">
						<p:toolbar>
							<f:facet name="left">
								<p:outputLabel value="选择告警时间：" style="margin-left:15px;" />
								<h:selectOneMenu id="alarmCycle_id" onchange="onChanged()"
									style="margin-left:10px;width:120px;margin-right:20px;height:30px">
									<f:selectItem itemLabel="7天内" itemValue="1" />
									<f:selectItem itemLabel="30天内" itemValue="2" />
									<f:selectItem itemLabel="三月内" itemValue="3" />
									<f:selectItem itemLabel="一年内" itemValue="4" />
								</h:selectOneMenu>
								<p:outputLabel value="起止时间：" style="margin-left:15px;" />
								<p:inputText id="startDate_id" type="text"
									style="margin-left: 2px; width: 120px; height: 30px" />
								<p:outputLabel value="至" style="margin-left:3px;margin-right: 2px; " />
								<p:inputText id="endDate_id" type="text"
									style="margin-left: 2px; width: 120px; margin-right: 2px; height: 30px" />
								<p:commandButton onclick="onBtnClick();" value="查询" style="margin-left:20px;"
									icon="ui-icon-search" />
							</f:facet>
						</p:toolbar>
						<div class="col-xs-12">
							<div class="col-lg-6 col-xs-6 no-padding">
								<div class="box box-primary ">
									<div class="box-body chart " id="chartDiv">
										<div id='dataAvailability' style="height: 600px"></div>
									</div>
								</div>
							</div>
							<div class="col-lg-6 col-xs-6 no-padding">
								<div class="box box-primary ">
									<div class="box-body chart" id="detailDialog">
										<div id="detailBar" style="height: 600px"></div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div id="detailPan" class="chart tab-pane">
						<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
							<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes"
								icon="ui-icon-check" />
							<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no"
								icon="ui-icon-close" />
						</p:confirmDialog>
						<h:form id="form">
							<p:growl id="msgs" showDetail="true" />
							<p:toolbar id="toolbar">
								<f:facet name="left">
									<p:outputLabel for="popup1" value="告警时间：" />
									<p:calendar id="popup1" navigator="true" value="#{dataSourceWarnController.queryDate1}"
										pattern="yyyy-MM-dd" maxdate="Date()">
									</p:calendar>
									<p:outputLabel for="popup2" value="至 " />
									<p:calendar id="popup2" navigator="true" value="#{dataSourceWarnController.queryDate2}"
										pattern="yyyy-MM-dd" maxdate="Date()" locale="zh">
									</p:calendar>
									<p:outputLabel for="selectStatus" value="告警状态：" style="margin-left:15px;" />
									<h:selectOneMenu value="#{dataSourceWarnController.status}" id="selectStatus"
										style="margin-left:10px;width:130px;margin-right:20px;height:30px">
										<f:selectItem itemLabel="全部" itemValue="2" />
										<f:selectItem itemLabel="告警中" itemValue="0" />
										<f:selectItem itemLabel="已恢复" itemValue="1" />
									</h:selectOneMenu>
									<p:commandButton value="查询" style="margin-left:20px;"
										action="#{dataSourceWarnController.initTable()}" icon="ui-icon-search"
										update=" form:dataTable1  form:msgs">
									</p:commandButton>
								</f:facet>
							</p:toolbar>
							<p:dataTable var="item" value="#{dataSourceWarnController.model}" id="dataTable1"
								selection="#{dataSourceWarnController.selected}" rowKey="#{item.id}" emptyMessage="无记录"
								lazy="true" selectionMode="single" paginator="true" paginatorPosition="bottom"
								paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
								rows="20" rowsPerPageTemplate="20,50,100">
								<f:facet name="{Customization}">
									<p:outputLabel value="总计：#{dataSourceWarnController.recordSize} 条记录"
										style="margin-right:20px;"></p:outputLabel>
								</f:facet>
								<p:column headerText="序号" style="width:50px;">
									<h:outputText value="#{dataSourceWarnController.getIndex(item)}" />
								</p:column>
								<p:column headerText="数据源">
									<h:outputText value="#{item.name}" />
								</p:column>
								<p:column headerText="第一次告警时间">
									<h:outputText value="#{item.triggerDate}">
										<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" timeZone="GMT+8" />
									</h:outputText>
								</p:column>
								<p:column headerText="最后一次告警时间">
									<h:outputText value="#{item.lastUpdateTime}">
										<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" timeZone="GMT+8" />
									</h:outputText>
								</p:column>
								<p:column headerText="告警原因">
									<h:outputText value="#{dataSourceWarnController.getDataType(item.type)}" />
								</p:column>
								<p:column headerText="状态">
									<h:outputText value="#{dataSourceWarnController.getStaus(item.status)}" />
								</p:column>
								<p:column headerText="操作" rendered="#{s:hasPermission(session,'zym_sjsjzxhq')}">
									<p:commandLink disabled="#{item.type==1}" value="重新获取"
										actionListener="#{dataSourceWarnController.regetData(item.id)}" update="form:msgs" />
								</p:column>
							</p:dataTable>
						</h:form>
					</div>
				</div>
			</div>
		</div>
	</ui:define>
	<ui:define name="contentend">
		<script src="#{request.contextPath}/resources/plugins/echarts/echarts.js"></script>
		<script src="#{request.contextPath}/resources/js/mycharts/categoryBarChart.js"></script>
		<script src="#{request.contextPath}/resources/js/array-util.js"></script>
		<script src="/resources/bootstrap/js/bootstrap-datetimepicker.min.js"></script>
		<script src="dataSourceWarn.js"></script>
	</ui:define>
</ui:composition>
